      <!-- navbar header -->
      <script>
          app.controller('mySearch', ['$state','$stateParams','$filter','$window','$http','$scope','$modal','toaster','$log', function($state,$stateParams,$filter,$window,$http,$scope,$modal,toaster,$log) {
              $scope.showMySearch = false;
              $scope.showSearch = function(){
                  $scope.showMySearch = !$scope.showMySearch;
              };
              $scope.searchData = {
                  "kh":"",
                  "startTime":"",
                  "endTime":"",
                  "content":"",
                  "type":""
              };
              $scope.mylist = [];
              $scope.searchResult = [];
              $scope.resultShow = false;

              function makeMyList(){
                  var app = $scope.app;
                  if(app.power.powerSaleOrder) {
                      $scope.mylist.push("销售订货单");
                  }
                  if(app.power.powerSaleWarehousing){
                      $scope.mylist.push("销售出库单");
                  }
                  if(app.power.powerSaleReturn) {
                      $scope.mylist.push("销售退货单");
                  }
                  if(app.power.powerPurchasingOrder){
                      $scope.mylist.push("采购订货单");
                  }
                  if(app.power.powerPurchasingWarehousing){
                      $scope.mylist.push("采购入库单");
                  }
                  if(app.power.powerPurchasingReturn){
                      $scope.mylist.push("采购退货单");
                  }
                  if(app.power.powerOthergoodOut){
                      $scope.mylist.push("其他出库单");
                  }
                  if(app.power.powerOthergoodIn){
                      $scope.mylist.push("其他入库单");
                  }
                  if(app.power.powerProductionPlan){
                      $scope.mylist.push("生产计划单");
                  }
                  if(app.power.powerProcessProcess){
                      $scope.mylist.push("工艺加工单");
                  }
                  if(app.power.powerInventory){
                      $scope.mylist.push("货品盘点单");
                  }
                  if(app.power.powerCommodityAssembly){
                      $scope.mylist.push("商品组装单");
                  }
                  if(app.power.powerMerchandiseDisassembly){
                      $scope.mylist.push("商品拆卸单");
                  }
                  if(app.power.powerTransfer){
                      $scope.mylist.push("货品调拨单");
                  }
                  if($scope.mylist.length<=0){
                      $scope.mylist.push("");
                  }
                  $scope.mylabel = $scope.mylist[0];
              }
              $scope.mylistMap = {
                  "采购订货单":"purchasingOrder",
                  "采购入库单":"purchasingWarehousing",
                  "采购退货单":"purchasingReturn",
                  "销售订货单":"saleOrder",
                  "销售出库单":"saleWarehousing",
                  "销售退货单":"saleReturn",
                  "其他入库单":"otherWarehousing",
                  "其他出库单":"otherOutlets",
                  "货品调拨单":"allocation",
                  "货品盘点单":"goodsInventory",
                  "商品组装单":"commodityAssembly",
                  "商品拆卸单":"merchandiseDisassembly",
                  "生产计划单":"productionPlan",
                  "工艺加工单":"processingSheet",
              };
              $scope.columns = [
                  {
                      title:'文件单号',
                      show:true
                  },
                  {
                      title:'制单人',
                      show:true
                  },
                  {
                      title:'客商',
                      show:true
                  },
                  {
                      title:'创建时间',
                      show:true
                  },
                  {
                      title:'文件状态',
                      show:true
                  }
              ];
              $scope.showSelectCustomer = function(){
                  var modalInstance = $modal.open({
                      templateUrl: 'selectCustomer.html',
                      controller: 'selectCustomerCtrl',
                      size: 'sm',
                      resolve: {
                          items: function () {
                              return $scope.message;
                          }
                      }
                  });
                  modalInstance.result.then(function (selectedItem) {
                      $scope.searchData.kh = selectedItem.name;
                  }, function () {
                      $log.info('Modal dismissed at: ' + new Date());
                  });
              };
              function makeData(data){
                  data.forEach(function(item){
                      item.myCreateTime = $filter("date")(item.myCreateTime, "yyyy/MM/dd HH:mm:ss");
                      if(item.state.indexOf("办结")>=0){
                          item.status1 = 'label bg-danger';
                      }else{
                          item.status1 = 'label bg-info';
                      }
                  });
                  $scope.searchResult = data;
              }
              $scope.showInfo = function(row){
                  $scope.showMySearch = false;
                  if($scope.searchData.type !=="" && row.docId !==""){
                      $state.go("app."+$scope.searchData.type,{docId:row.docId});
                  }
              };
              $scope.doSearch = function(){
                  $scope.resultShow = true;
                  $scope.searchData.type = $scope.mylistMap[$scope.mylabel];
                  $scope.searchData.startTime = new Date($scope.searchData.startTime).getTime();
                  $scope.searchData.endTime = new Date($scope.searchData.endTime).getTime();
                  $http.post("/a_yongan/selectall/select",$scope.searchData).then(function(response) {
                      if(!response.data.isLogin) {
                          $.cookie('userName', null);
                          $.cookie('userId', null);
                          $.cookie('isLOgin', false);
                          $state.go('access.signin');
                      }else{
                          if(response.data.success){
                              makeData(response.data.data);
                          }
                      }
                  }, function(x) {
                      console.log("接口请求出错！");
                  });
              };
              makeMyList();
              var dataF = {
                  "success": true,
                  "data": [{
                      "salesOrderId": "49ff207b-ebde-4c14-a676-b2cd4134fe83",
                      "salesOrderXsdh": "XSDD20190420105935",
                      "salesOrderDdrq": 1555689600000,
                      "salesOrderShrq": 1555689600000,
                      "salesOrderGmkh": "陕西西咸文化旅游产业集团有限公司",
                      "salesOrderDhr": "张建军",
                      "salesOrderLxdh": "1533628921223",
                      "salesOrderXsck": "仓库二",
                      "salesOrderXsje": "12000",
                      "salesOrderXsy": "刘星",
                      "salesOrderShdz": "陕西省西安市",
                      "isChecked": false,
                      "zdr": "系统管理员",
                      "zdrId": "admin",
                      "state": "审批",
                      "salesOrderJsfs": "银行转账",
                      "upDateUserId": "a5348832-49",
                      "createTime": 1555729291000,
                      "updateTime": 1555733392000,
                      "details": [{
                          "salesOrderDetailsId": "1555729214352",
                          "salesOrderDetailsHpbm": "HP20190331135325",
                          "salesOrderDetailsHpmc": "控制阀",
                          "salesOrderDetailsGgxh": "UCD",
                          "salesOrderDetailsHpdw": "件",
                          "salesOrderDetailsHpsl": "12",
                          "salesOrderDetailsHpdj": "25",
                          "salesOrderDetailsSl": null,
                          "salesOrderDetailsHpzje": "300",
                          "salesOrderDetailsBz": "备注一下",
                          "salesOrderDetailsCksl": null,
                          "salesOrderDetailsDhrq": 1555689600000,
                          "topId": "49ff207b-ebde-4c14-a676-b2cd4134fe83",
                          "salesOrderDetailsOrder": null,
                          "createTime": null,
                          "updateTime": null,
                          "goodsinformationList": null
                      },{
                          "salesOrderDetailsId": "1555729238434",
                          "salesOrderDetailsHpbm": "HP20190331135127",
                          "salesOrderDetailsHpmc": "燃气表",
                          "salesOrderDetailsGgxh": "L3",
                          "salesOrderDetailsHpdw": "个",
                          "salesOrderDetailsHpsl": "50",
                          "salesOrderDetailsHpdj": "20",
                          "salesOrderDetailsSl": null,
                          "salesOrderDetailsHpzje": "1000",
                          "salesOrderDetailsBz": "备注两下",
                          "salesOrderDetailsCksl": null,
                          "salesOrderDetailsDhrq": 1555689600000,
                          "topId": "49ff207b-ebde-4c14-a676-b2cd4134fe83",
                          "salesOrderDetailsOrder": null,
                          "createTime": null,
                          "updateTime": null,
                          "goodsinformationList": null
                      }]
                  },{
                      "salesOrderId": "49ff207b-ebde-4c14-a676-b2cd4134fe83",
                      "salesOrderXsdh": "XSDD20190420105935",
                      "salesOrderDdrq": 1555689600000,
                      "salesOrderShrq": 1555689600000,
                      "salesOrderGmkh": "陕西西咸文化旅游产业集团有限公司",
                      "salesOrderDhr": "张建军",
                      "salesOrderLxdh": "1533628921223",
                      "salesOrderXsck": "仓库二",
                      "salesOrderXsje": "12000",
                      "salesOrderXsy": "刘星",
                      "salesOrderShdz": "陕西省西安市",
                      "isChecked": false,
                      "zdr": "系统管理员",
                      "zdrId": "admin",
                      "state": "审批",
                      "salesOrderJsfs": "银行转账",
                      "upDateUserId": "a5348832-49",
                      "createTime": 1555729291000,
                      "updateTime": 1555733392000,
                      "details": [{
                          "salesOrderDetailsId": "1555729214352",
                          "salesOrderDetailsHpbm": "HP20190331135325",
                          "salesOrderDetailsHpmc": "控制阀",
                          "salesOrderDetailsGgxh": "UCD",
                          "salesOrderDetailsHpdw": "件",
                          "salesOrderDetailsHpsl": "12",
                          "salesOrderDetailsHpdj": "25",
                          "salesOrderDetailsSl": null,
                          "salesOrderDetailsHpzje": "300",
                          "salesOrderDetailsBz": "备注一下",
                          "salesOrderDetailsCksl": null,
                          "salesOrderDetailsDhrq": 1555689600000,
                          "topId": "49ff207b-ebde-4c14-a676-b2cd4134fe83",
                          "salesOrderDetailsOrder": null,
                          "createTime": null,
                          "updateTime": null,
                          "goodsinformationList": null
                      },
                          {
                              "salesOrderDetailsId": "1555729238434",
                              "salesOrderDetailsHpbm": "HP20190331135127",
                              "salesOrderDetailsHpmc": "燃气表",
                              "salesOrderDetailsGgxh": "L3",
                              "salesOrderDetailsHpdw": "个",
                              "salesOrderDetailsHpsl": "50",
                              "salesOrderDetailsHpdj": "20",
                              "salesOrderDetailsSl": null,
                              "salesOrderDetailsHpzje": "1000",
                              "salesOrderDetailsBz": "备注两下",
                              "salesOrderDetailsCksl": null,
                              "salesOrderDetailsDhrq": 1555689600000,
                              "topId": "49ff207b-ebde-4c14-a676-b2cd4134fe83",
                              "salesOrderDetailsOrder": null,
                              "createTime": null,
                              "updateTime": null,
                              "goodsinformationList": null
                          }]
                  }],
                  "error": null,
                  "isLogin": true
              }
              var rs = [];
              function makeSheet(){
                  var Title = ['单据时间','销售单号','购买客户','货品编码','货品名称','数量'];
                  rs.push(Title);
                  var st = [];
                  dataF.data.forEach(function(item){
                      var detailsInt = 0;
                      item.details.forEach(function(idetails,index){
                          if(index===0){
                              var line = [
                                  $filter("date")(new Date(item.createTime), "yyyy/MM/dd"),
                                  item.salesOrderXsdh,
                                  item.salesOrderGmkh,
                                  idetails.salesOrderDetailsHpbm,
                                  idetails.salesOrderDetailsHpmc,
                                  idetails.salesOrderDetailsHpsl
                              ];
                          }else{
                              var line = [
                                  null,
                                  null,
                                  null,
                                  idetails.salesOrderDetailsHpbm,
                                  idetails.salesOrderDetailsHpmc,
                                  idetails.salesOrderDetailsHpsl
                              ];
                          }
                          detailsInt = detailsInt+1;
                          rs.push(line);
                      });

                  });
              }
              $scope.fileExcel = function(){
                  makeSheet();
                  if(rs.length===0 || rs===null){
                      showMessage('warning','','未检测到数据！');
                      return;
                  }
                  var sheet = XLSX.utils.aoa_to_sheet(rs);
                  sheet['!merges'] = [    // 设置A1-C1的单元格合并
                      {s: {r: 1, c: 0}, e: {r: 2, c: 0}},{s: {r: 1, c: 1}, e: {r: 2, c: 1}},{s: {r: 1, c: 2}, e: {r: 2, c: 2}}
                      ,{s: {r: 3, c: 0}, e: {r: 4, c: 0}},{s: {r: 3, c: 1}, e: {r: 4, c: 1}},{s: {r: 3, c: 2}, e: {r: 4, c: 2}}
                  ];
                  toaster.fileExcels(sheet,'导出'+$filter("date")(new Date(), "yyyy年MM月dd日HH时mm分ss秒")+'.xlsx');
              };
          }]);
      </script>
      <div class="navbar-header {{app.settings.navbarHeaderColor}}">
        <button class="pull-right visible-xs dk" ui-toggle-class="show" data-target=".navbar-collapse">
          <i class="glyphicon glyphicon-cog"></i>
        </button>
        <button class="pull-right visible-xs" ui-toggle-class="off-screen" data-target=".app-aside" ui-scroll="app">
          <i class="glyphicon glyphicon-align-justify"></i>
        </button>
        <!-- brand -->
        <a href="#/" class="navbar-brand text-lt">
          <i>
            <img src="./img/icos/login.png"/>
          </i>
          <img src="img/logo.png" alt="." class="hide">
          <span class="hidden-folded m-l-xs">{{app.name}}</span>
        </a>
        <!-- / brand -->
      </div>
      <!-- / navbar header -->

      <!-- navbar collapse -->
      <div class="collapse pos-rlt navbar-collapse box-shadow {{app.settings.navbarCollapseColor}}">
        <!-- buttons -->
        <div class="nav navbar-nav hidden-xs">
          <a href class="btn no-shadow navbar-btn" ng-click="app.settings.asideFolded = !app.settings.asideFolded">
            <i class="fa {{app.settings.asideFolded ? 'fa-indent' : 'fa-dedent'}} fa-fw"></i>
          </a>
          <!--<a href class="btn no-shadow navbar-btn" ui-toggle-class="show" target="#aside-user">-->
            <!--<i class="icon-user fa-fw"></i>-->
          <!--</a>-->
        </div>
        <!-- / buttons -->

        <!-- link and dropdown -->
        <ul class="nav navbar-nav hidden-sm" ng-controller="mySearch">
          <li class="dropdown pos-stc">
            <a href class="dropdown toggle"  ng-click="showSearch()">
              <span>汇总查询</span>
              <span class="caret"></span>
            </a>
            <div ng-show="showMySearch" class="dropdown-menu wrapper w-full bg-white" style="display: inline-block">
              <div class="">
                <div class="panel-body">
                  <form class="form-horizontal">
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group">
                      <label class="col-sm-1 control-label" for="input-id-1">业务类型</label>
                      <div class="col-sm-3">
                        <select  class="form-control" ng-model="mylabel" ng-options="v for v in mylist"></select>
                      </div>
                      <label class="col-sm-1 control-label" for="input-id-1">起始日期</label>
                      <div class="col-sm-3" ng-controller="DatepickerDemoCtrl">
                        <input readonly style="width:83%;float: left" type="text" class="form-control" datepicker-popup="{{format}}" ng-model="searchData.startTime" is-open="opened" datepicker-options="dateOptions" ng-required="true" close-text="关闭" />
                        <span class="input-group-btn">
                          <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                        </span>
                      </div>
                      <label class="col-sm-1 control-label" for="input-id-1">结束日期</label>
                      <div class="col-sm-3" ng-controller="DatepickerDemoCtrl">
                        <input readonly style="width:83%;float: left" type="text" class="form-control" datepicker-popup="{{format}}" ng-model="searchData.endTime" is-open="opened" datepicker-options="dateOptions" ng-required="true" close-text="关闭" />
                        <span class="input-group-btn">
                          <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                        </span>
                      </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group">
                      <label class="col-sm-1 control-label" for="input-id-1">客        商</label>
                      <div class="col-sm-3">
                        <input style="width:84%;float: left" ng-model="searchData.kh" type="text" class="form-control" value="{{searchData.kh}}">
                        <span class="input-group-btn">
                            <button ng-click="showSelectCustomer()" class="btn btn-default" type="button"><i class="fa fa-plus"></i></button>
                        </span>
                      </div>
                      <label class="col-sm-1 control-label" for="input-id-1">单据编号</label>
                      <div class="col-sm-3">
                        <input ng-model="searchData.content" type="text" class="form-control" value="{{searchData.content}}">
                      </div>
                      <label class="col-sm-4 control-label" for="input-id-1">
                        <button ng-click="doSearch()" style="float:left" class="btn m-b-xs btn-sm btn-primary btn-addon">
                          <i class="fa fa-search"></i>搜索
                        </button>
                        <button ng-click="showSearch()" style="float:left;margin-left: 5px;" class="btn m-b-xs btn-sm btn-danger btn-addon">
                          <i class="fa fa-close"></i>关闭
                        </button>
                        <button ng-click="resultShow = !resultShow" style="float:left;margin-left: 5px;" class="btn m-b-xs btn-sm btn-info btn-addon">
                          <i class="fa fa-arrows-v"></i>收起
                        </button>
                        <button ng-click="fileExcel()" style="float: left;margin-left: 5px;" class="btn m-b-xs btn-sm btn-success btn-addon">
                          <i class="fa fa-file-excel-o"></i>导出
                        </button>
                      </label>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <table ng-show="resultShow" class="table m-b-none" ui-jq="footable" data-filter="#filter" data-page-size="5">
                      <thead>
                      <tr>
                        <th>{{columns[0].title}}</th>
                        <th>{{columns[1].title}}</th>
                        <th>{{columns[2].title}}</th>
                        <th>{{columns[3].title}}</th>
                        <th>{{columns[4].title}}</th>
                      </tr>
                      </thead>
                      <tbody>
                      <tr ng-repeat="tb in searchResult">
                        <td><a href ng-click="showInfo(tb)"><u>{{tb.number}}</u></a></td>
                        <td>{{tb.zdr}}</td>
                        <td>{{tb.gys}}</td>
                        <td>{{tb.myCreateTime}}</td>
                        <td><span class="{{tb.status1}}">{{tb.state}}</span></td>
                      </tr>
                      </tbody>
                      <tfoot class="hide-if-no-paging">
                      <tr>
                        <td colspan="5" class="text-center">
                          <ul class="pagination"></ul>
                        </td>
                      </tr>
                      </tfoot>
                    </table>
                  </form>
                </div>
              </div>
            </div>
          </li>
        </ul>
        <!-- / link and dropdown -->
        <!-- search form -->
        <!--<form class="navbar-form navbar-form-sm navbar-left shift" ui-shift="prependTo" target=".navbar-collapse" role="search" ng-controller="TypeaheadDemoCtrl">-->
          <!--<div class="form-group">-->
            <!--<div class="input-group">-->
              <!--<input type="text" ng-model="selected" typeahead="state for state in states | filter:$viewValue | limitTo:8" class="form-control input-sm bg-light no-border rounded padder" placeholder="Search projects...">-->
              <!--<span class="input-group-btn">-->
                <!--<button type="submit" class="btn btn-sm bg-light rounded"><i class="fa fa-search"></i></button>-->
              <!--</span>-->
            <!--</div>-->
          <!--</div>-->
        <!--</form>-->
        <!-- / search form -->

        <!-- nabar right -->
        <ul class="nav navbar-nav navbar-right">
          <!--<li class="dropdown hidden-sm" is-open="lang.isopen" dropdown>-->
            <!--<a href class="dropdown-toggle" dropdown-toggle>-->
              <!--{{selectLang}} <b class="caret"></b>-->
            <!--</a>-->
            <!--&lt;!&ndash; dropdown &ndash;&gt;-->
            <!--<ul class="dropdown-menu animated fadeInRight w">-->
              <!--<li ng-repeat="(langKey, label) in langs">-->
                <!--<a ng-click="setLang(langKey, $event)" href>{{label}}</a>-->
              <!--</li>-->
            <!--</ul>-->
            <!--&lt;!&ndash; / dropdown &ndash;&gt;-->
          <!--</li>-->
          <li class="hidden-xs">
            <a ui-fullscreen></a>
          </li>
          <!--<li class="dropdown" dropdown>-->
            <!--<a href class="dropdown-toggle" dropdown-toggle>-->
              <!--<i class="icon-bell fa-fw"></i>-->
              <!--<span class="visible-xs-inline">Notifications</span>-->
              <!--<span class="badge badge-sm up bg-danger pull-right-xs">2</span>-->
            <!--</a>-->
            <!--&lt;!&ndash; dropdown &ndash;&gt;-->
            <!--<div class="dropdown-menu w-xl animated fadeInUp">-->
              <!--<div class="panel bg-white">-->
                <!--<div class="panel-heading b-light bg-light">-->
                  <!--<strong>You have <span>2</span> notifications</strong>-->
                <!--</div>-->
                <!--<div class="list-group">-->
                  <!--<a href class="media list-group-item">-->
                    <!--<span class="pull-left thumb-sm">-->
                      <!--<img src="img/a0.jpg" alt="..." class="img-circle">-->
                    <!--</span>-->
                    <!--<span class="media-body block m-b-none">-->
                      <!--Use awesome animate.css<br>-->
                      <!--<small class="text-muted">10 minutes ago</small>-->
                    <!--</span>-->
                  <!--</a>-->
                  <!--<a href class="media list-group-item">-->
                    <!--<span class="media-body block m-b-none">-->
                      <!--1.0 initial released<br>-->
                      <!--<small class="text-muted">1 hour ago</small>-->
                    <!--</span>-->
                  <!--</a>-->
                <!--</div>-->
                <!--<div class="panel-footer text-sm">-->
                  <!--<a href class="pull-right"><i class="fa fa-cog"></i></a>-->
                  <!--<a href="#notes" data-toggle="class:show animated fadeInRight">See all the notifications</a>-->
                <!--</div>-->
              <!--</div>-->
            <!--</div>-->
            <!--&lt;!&ndash; / dropdown &ndash;&gt;-->
          <!--</li>-->
          <li class="dropdown" dropdown>
            <a href class="dropdown-toggle clear" dropdown-toggle>
              <span class="hidden-sm hidden-md">{{app.userName}}</span> <b class="caret"></b>
            </a>
            <!-- dropdown -->
            <ul class="dropdown-menu animated fadeInRight w">
              <li>
                <a  ng-click="app.userMessage()">
                  <span class="badge bg-danger pull-right">{{app.userName}}</span>
                  <span>个人资料</span>
                </a>
              </li>
              <li>
                <a  ng-click="app.changePassword()">修改密码</a>
              </li>
              <li>
                <a ui-sref="app.docs">
                  <span class="label bg-info pull-right">new</span>
                  帮助
                </a>
              </li>
              <li class="divider"></li>
              <li>
                <a  ng-click="app.logout()" >注销</a>
                <!--ui-sref="access.signin"-->
              </li>
            </ul>
            <!-- / dropdown -->
          </li>
        </ul>
        <!-- / navbar right -->

      </div>
      <!-- / navbar collapse -->

      <script type="text/ng-template" id="selectCustomer.html">
        <div ng-include="'tpl/selectCustomer.html'"></div>
      </script>